package jw.hospital.utils;

import jw.hospital.helper.JwtHelper;

import javax.servlet.http.HttpServletRequest;

//获取当前用户签名的工具类
public class AuthContextHolder {
    public  static Long  getUserId(HttpServletRequest request){
        String token = request.getHeader("token");
        //jwt从token中获取userId
        Long userId = JwtHelper.getUserId(token);
        return userId;

    }

    public  static  String  getUserName(HttpServletRequest request){
        String token = request.getHeader("token");
        String userName = JwtHelper.getUserName(token);
        return userName;
    }
}
